package com.thunisoft.com;


public enum StepType implements IAction {

    STEP1("step1",Execute::step1),
    STEP2("step2",Execute::step2),
    STEP3("step3",Execute::step3);

    private final String name;

    private final IAction action;

    StepType(String name, IAction action) {
        this.name = name;
        this.action = action;
    }

    @Override
    public Po execute(Execute execute) {
        return action.execute(execute);
    }

    public String getName() {
        return name;
    }

    public static StepType getInstance(String name){
        for (StepType value : StepType.values()) {
            if (value.getName().equals(name)) {
                return value;
            }
        }
        throw  new IllegalArgumentException("参数不存在");
    }
}
